<?php
/**
 * Created by ModelCreater.
 * Date: 2023-09-22
 * Time: 17:32:05
 */
namespace model;

use lib\common\CommonModel;
use think\model\concern\SoftDelete;

class FileModel extends CommonModel
{


    protected $table = 'file';

    protected $autoWriteTimestamp = 'datetime';
    protected $createTime = 'create_time';
    protected $updateTime = false;

    protected $schema = [
        'id'          => 'int',
        'path'        => 'string',
        'origin_name' => 'string',
        'ext'         => 'string',
        'size'        => 'int',
        'file_hash'   => 'string',
        'bucket'      => 'string',
        'endpoint'    => 'string',
        'create_time' => 'datetime',
    ];

    public function getFileByHash ($hash, $type) {
        return $this->where('file_hash', $hash)->where('type', $type)->find();
    }
}
